home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -screenplay- / shareware / amigapmars / validate.red < prev    next >
Text File  |  1994-06-10  |  3KB  |  118 lines

  1. ;redcode
  2. ;name Validate 1.1R
  3. ;author Stefan Strack
  4. ;strategy System validation program - based on Mark Durham's validation suite
  5. ;
  6. ;   This program tests your corewar system for compliance with the ICWS88-
  7. ;   standard and compatibility with KotH. It self-ties (i.e. loops forever)
  8. ;   if the running system is ICWS88-compliant and uses in-register evaluation;
  9. ;   suicides (terminates) if the interpreter is not ICWS compliant and/or uses
  10. ;   in-memory evaluation. A counter at label 'flag' can be used to determine
  11. ;   where the exception occured.
  12. ;
  13. ;   Tests:
  14. ;   -all opcodes and addressing modes
  15. ;   -ICWS88-style ADD/SUB
  16. ;   -ICWS88-style SPL
  17. ;   -correct timing
  18. ;   -in-memory vs. in-register evaluation
  19. ;   -core initialization
  20. ;
  21. ;   Version 1.1: added autodestruct in case process gets stuck
  22.  
  23.  
  24. ;assert MAXLENGTH >= 90
  25.  
  26. start   spl l1,count+1
  27.         jmz <start,0
  28. count   djn count,#36      ;time cycles
  29.         sub #1,@start
  30. clear   mov t1,<last+2     ;autodestruct if stuck
  31.         jmp clear
  32. t1      dat #0,#1
  33. t2      dat #0,#3
  34. l1      spl l2
  35.         dat <t2,<t2
  36. l2      cmp t1,t2
  37.         jmp fail
  38.         spl l4
  39.         jmz l3,<0
  40. t3      dat #0,#1
  41. t4      dat #0,#2
  42. l3      jmp @0,<0
  43. l4      jmp <t5,#0
  44.         jmp l5
  45. t5      dat #0,#0
  46. t6      dat #0,#-1
  47. l5      cmp t3,t4
  48.         jmp fail
  49.         cmp t5,t6
  50.         jmp fail
  51.         jmp <t7,<t7
  52.         jmp l6
  53. t7      dat #0,#0
  54. t8      dat #0,#-2
  55. l6      cmp t7,t8
  56.         jmp fail
  57.         mov t9,<t9         ;test in-memory evaluation
  58. t9      jmn l7,1
  59. t10     jmn l7+1,1
  60. l7      cmp t9,t10
  61.         jmp fail
  62.         mov @0,<t11
  63. t11     jmn l8,1
  64. t12     jmn l8+1,1
  65. l8      cmp t11,t12
  66.         jmp fail
  67.         spl l9
  68.         mov <t13,t14
  69. t13     dat <0,#1
  70. t14     dat <0,#1
  71. t15     dat <0,#-1
  72. l9      mov <t16,t16
  73. t16     jmz l10,1
  74.         jmp fail
  75. l10     cmp t13,t15
  76.         jmp fail
  77.         add t17,<t17
  78. t17     jmp 1,1
  79. t18     jmp 2,1
  80.         cmp t17,t18
  81.         jmp fail
  82.         add @0,<t19
  83. t19     jmp 1,1
  84.         jmp fail
  85.         cmp t18,t19
  86.         jmp fail
  87.         spl l11            ;ICWS86 SPL will fail here
  88.         cmp t20,t21
  89.         jmp l12
  90.         jmp fail
  91. l11     sub <t20,t20
  92. t20     dat #2,#1
  93. t21     dat #0,#0
  94. l12     cmp t20,t21
  95.         jmp fail
  96. t22     sub <t23,<t23
  97. t23     jmp l13,1
  98. t24     sub <-2,<1
  99. t25     jmp l13+2,-1
  100. l13     cmp t22,t24
  101.         jmp fail
  102.         cmp t23,t25
  103.         jmp fail
  104.         cmp start-1,t26    ;Core initialization dat 0,0
  105.         jmp l14
  106.         jmp fail
  107. t26     dat #0,#0
  108. l14     slt #0,count       ;check cycle timer
  109.         jmp success
  110. fail    mov count,flag     ;save counter for post-mortem debugging
  111.     mov t1,count       ;kill counter
  112.     jmp clear          ;and auto-destruct
  113. flag    dat #0
  114. success mov flag,clear     ;cancel autodestruct
  115. last    jmp 0              ;and loop forever
  116.  
  117.         end start
  118.